Repository navigation
fix(watchdog): alert when a wrong build holds the opencode port (#8255) - #8295
Conversation
…#8255) The dark-port watchdog (code#7780) treats any serving port as healthy, so on 2026-11-10 it stayed silent while a two-generations-old build held port 13420 for ~2 days and generation switches reported success. Add a build-identity assertion: when opencode.service is active, the watchdog reads the registered service version from /api/info (credentials from the channel registration file) and compares it with services.opencode-watchdog.expectedVersion, which home/common derives from the name of the same cascade package the unit runs — expectation and ExecStart resolve from one derivation. A mismatch held past the grace window alerts on the same surface as the dark case (the watchdog unit exits 1) but never restarts a serving unit: replacing a wrong build is the switch procedure's deliberate act, and the watchdog must never race a handover. An unreadable registration or probe is not evidence; only a positively different version counts. Test hooks: OPENCODE_WATCHDOG_EXPECTED_VERSION / OPENCODE_WATCHDOG_REGISTRATION_FILE.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27d19d35a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }; | ||
|
|
||
|
|
||
| services.opencode-watchdog.expectedVersion = watchdogExpectedVersion; |
There was a problem hiding this comment.
Set the expected version in the NixOS module scope
home/common is merged into home-manager.users.user, .root, and .backup by home/{user,root,backup}/default.nix, but services.opencode-watchdog.expectedVersion is declared in the NixOS module at nixos/services/opencode-watchdog/default.nix:156–174, not in Home Manager. This assignment therefore defines an unknown Home Manager option and prevents configurations importing this shared file from evaluating. It also does not populate the NixOS watchdog's cfg.expectedVersion, whose empty default disables the new identity check. Move the assignment to the NixOS configuration scope while retaining the same package-derived version.
Useful? React with 👍 / 👎.
What
The opencode watchdog (code#7780) treats any serving port as healthy. On 2026-11-10 that blind spot hid the #8255 failure for ~2 days: port 13420 served a two-generations-old build while generation switches reported success, because a service-mode starter silently defers to any registered incumbent.
This PR adds a build-identity assertion to the watchdog:
opencode.serviceis active, the watchdog reads the registered service's version from/api/info(credentials from the channel registration file, never printed) and compares it against the newservices.opencode-watchdog.expectedVersionoption.home/commonsetsexpectedVersionfrom the name of the very cascade package derivation the unit runs — expectation and ExecStart resolve from one derivation and cannot drift apart (evaluates to2.0.30+3497ea2on current main, matching production).services.opencode-watchdog.channel, defaultprod). Test hooks:OPENCODE_WATCHDOG_EXPECTED_VERSION/OPENCODE_WATCHDOG_REGISTRATION_FILE.Verification
nix evalof the host config:services.opencode-watchdog.expectedVersionresolves to2.0.30+3497ea2(the running build); the watchdog derivation's baked script contains the check with that expectation.Refs #8255
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.